/* ************************************************************************
> File Name:     str.c
> Author:        程序员lyl
> 微信公众号:    雨特宙
> Created Time:  2024年04月10日 星期三 16时00分29秒
> Description:   
 ************************************************************************/
#include <stdio.h>
#include <string.h>

void reverseString(char* s, int len){

    int i = 0;
    int j = len - 1;
    while(i < j){

        int tmp = s[i];
        s[i++] = s[j];
        s[j--] = tmp;
        //i++;
        //j--;

    }
}

int palindromeString(char* s, int len){

    int i = 0;
    int j = len - 1;
    while(i++ < j--){
        if(s[i] != s[j])
            return 0;
    }
    return 1;
}



int main(){
    char ss[] = "abcde";
    //char* str = "abcde";
    char ss1[] = "abadefedcba";
    int len1 = strlen(ss);
    int len2 = strlen(ss1);
    //printf("%d\n",len1);
    //int len2 = sizeof(str);
    //printf("%d\n",len2);
    //int len3 = sizeof(str)/sizeof(*str);
    //printf("%d\n",len3);
    //int len4 = sizeof(ss)/sizeof(ss[0]);
    //printf("%d\n",len4);

    reverseString(ss,len1);
    printf("%s\n", ss);
    int result= palindromeString(ss1,len2);
    printf("%s\n", result ? "ss1 is palindromeString" : "ss1 not palindromeString");
    
    int n;
    char inputStr[100];
    scanf("%d ",&n);
    while(n--){
        fgets(inputStr,sizeof(inputStr),stdin);
        inputStr[strcspn(inputStr,"\n")] = '\0';
        int len3 = strlen(inputStr);
        printf("%d\n", len3);
        int result= palindromeString(inputStr,len3);
        printf("%s\n", result ? "inputStr is palindromeString" : "inputStr not palindromeString");
    }
    //fgets(inputStr,sizeof(inputStr),stdin);
    //printf("%d", (int)strlen(inputStr));


}
